<!DOCTYPE html >
<html>
<head>
<meta name="Generator" content="TPshop v1.1" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>个人简介</title>
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<link rel="stylesheet" href="__ROOT__ /AI_radar/css/footer.css">
<link rel="stylesheet" href="__ROOT__ /AI_radar/css/font_my/iconfont.css">
<link rel="stylesheet" href="__ROOT__ /AI_radar/js/qiniu/indexs.css">
<link rel="stylesheet" href="__ROOT__ /AI_radar/css//my/intro.css">
<script type="text/javascript" src="__ROOT__ /AI_radar/js/token.js"></script>
	<script src='__ROOT__ /AI_radar/js/jquery.js'></script>
	<script type="text/javascript" src='__ROOT__ /AI_radar/js/qiniu/qiniu.min.js'></script>
	<script type="text/javascript" src='__ROOT__ /AI_radar/js/qiniu/md5.js'></script>
	<script type="text/javascript" src='__ROOT__ /AI_radar/js/qiniu/widget.js'></script>
	<script type="text/javascript" src='__ROOT__ /AI_radar/js/qiniu/common.js'></script>
	<script type="text/javascript" src='__ROOT__ /AI_radar/js/qiniu/ui.js'></script>
    <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<!-- <style type="text/css">
	body,html{
		width: 100%;
		height: 100%;
		margin: 0;
		padding: 0;
		overflow-x: hidden;
    background: #eee;
		color:#555555;
	}
	p{
		margin: 0;
	}
	.bian{
		width: calc(100% - 20px);
		padding: 0 10px;
	}
	.introYin{
		display: flex;
		background: #eee;
		line-height: 50px;
	}
	.introYinL{
		width: calc(100% - 90px);
		font-weight: bold;
		font-size: 16px
	}
	.introYinR{
		width: 90px;
		text-align: right;
	}
	textarea{
		width: 100%;
		height: 100px;
		resize: none;
		border:none;
	}
	.aaP{
		text-align: right;
		color: #4f81d4;
		line-height: 35px
	}
	.yanse,.introSY{
		background:#fff;
	}
	.audio{
		width: 100%;
		display: flex;
	}
	.audioBtnL{
		width: 80px;
	}
	.audioBof{
		width: 40px;
		border-radius: 50%;
		margin: 10px 20px;
	}
	.audioBof img{
		width: 100%;
		border-radius: 50%;
	}
	.audioBtnR{
		width: calc(100% - 130px);
		line-height: 60px;
		color:#f6b37f;
	}
  .audioBtnRT{
    width: calc(100% - 10px);
    padding-right: 10px;
    line-height: 25px;
    text-align: right;
  }
  .audioBtnRB{
    line-height: 35px;
  }
  .chuans{
    line-height: 30px;
    background: #4f81d4;
    color: #fff;
    text-align: center;
    border-radius: 3px;
    margin-top: 25px;
  }
  .audioBtnC{
    width: 50px;
    
  }
	.introBiao{
		background: #fff;
	}
	.introAdd{
		width: 100%;
		padding: 10px 0;
	}
	.introAddNtn{
		width: 100px;
		height: 30px;
		border-radius:15px;
		border:1px solid #ccc;
/*		background: url("__ROOT__ /AI_radar/image/my/jhd.png");
		background-size: 20px 20px;
		background-position: center;
		background-repeat: no-repeat;*/
		background-color: #eee;
		display: inline-block;
		margin: 5px;
		line-height: 30px;
		text-align: center;
	}
/*	.introAddNtn img{

	}*/
	.introDis{
		display: none;
	}
	.text{
		line-height: 30px;
		padding: 0 10px;
		margin: 5px;
		border-radius:15px;
		border:1px solid #ccc;
		display: inline-block;

	}
	.zt{
		padding: 0 5px;
	}
	.texts{
		line-height: 30px;
		padding: 0 10px;
		margin: 5px;
		border-radius:15px;
		display: inline-block;
		background: #eee;

	}
	.introZhao{
		position: relative;
    background: #fff;
	}
	.chuan{
		display: flex;
	}

  .baoBtn{
    width: 100%;
    line-height: 35px;
    color: #fff;
    background: #4f81d4;
    text-align: center;
    margin: 20px 0;
  }
  #box2{
    margin: 5px;
  }
  .zhus{
    width: calc(100% - 20px);
    padding: 0 10px;
    margin-top: 20px;
    color: red;
    font-size: 13px;
  }
  .tanbiao{
    position: fixed;
    top: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;

  }
  .tbz{
    width: 90%;
    height: 150px;
    background: #fff;
    border-radius: 5px;
    margin-top: calc(50% - 20px);
    margin-left: 5%;
  }
  .tbzt{
    line-height: 50px;
    text-align: center;
    border-bottom: 1px solid #eee;
  }
  .tbzi{
    width: calc(100% - 22px);
    padding: 0 10px;

  }
  .tbzinput{
    width: 100%;
    height: 30px;
  }
  .tbzBtn{
    width: calc(100% - 20px);
    padding: 0 10px;
    display: flex;
  }
  .tbzBtnN{
    width: calc(100% - 20px);
    margin: 10px;
    text-align: center;
    line-height: 30px;
    color: #4f81d4;
    border:1px solid #4f81d4;
  }
  .tbzBtnY{
    width: calc(100% - 20px);
    margin: 10px;
    text-align: center;
    line-height: 30px;
    background: #4f81d4;
    color: #fff;
  }
/*简介例子*/
  .tants{
    position: fixed;
    top: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
  }
  .ttz{
    width: 90%;
    height: 250px;
    background: #fff;
    border-radius: 5px;
    margin-top: calc(50% - 50px);
    margin-left: 5%;
    position: relative;
  }
  .ttzt{
    line-height: 50px;
    text-align: center;
    border-bottom: 1px solid #eee;
  }
  .ttzdiv{
    width: calc(100% - 20px);
    height: 190px;
    padding: 0 10px;
    overflow-x: hidden;
  }
  .ttzBtn{
    position: absolute;
    top:5px;
    right: 5px;
    width: 30px;
    height: 30px;
    text-align: center;
    line-height: 30px;
  }
/*录制语音*/
  .tanSY{
    position: fixed;
    top: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
  }
  .tSYz{
    width: 90%;
    height: 70%;
    background: #eee;
    border-radius: 5px;
    margin-top: 15%;
    margin-left: 5%;
    position: relative;
    overflow:hidden;
  }
  .tSYzt{
    line-height: 50px;
    text-align: center;
    border-bottom: 1px solid #eee;
    background: #fff;
  }
  .tSYzi{
    width: 100%;
    height: 40%;
    display: inline-block;
    background: #fff;
  }
  .tSYzn{
    width: 60px;
    height: 60px;
    /*margin: auto;*/
    /*vertical-align: middle;*/
    margin-left: calc(50% - 30px);
    margin-top: 10%;
  
    border-radius: 50%;
    border:1px solid #f6b37f;
    box-shadow: 0 0 10px #f6b37f;
  }
  .tSYzn img{
    width: 100%;
    border-radius: 50px;
  }
  .tSYzts{
    width: 100%;
    line-height: 30px;
    text-align: center;
    margin-bottom: 20px;
    background: #fff;

  }
  .tSYzli{
    width: calc(100% - 20px);
    height: calc(100% - 100px);
    padding: 0 10px;
    overflow-y: auto;
    /*background: #eee;*/
  }
  .tSYzBtn{
    position: absolute;
    top:5px;
    right: 5px;
    width: 30px;
    height: 30px;
    text-align: center;
    line-height: 30px;
  }
  .tsTimes{
    text-align: center;
    font-size: 15px;
  }
  .tsTimesNum{
    font-size: 18px;
  }

</style>
 -->
</head>
<body>
	<div class="intro">
		<div class="bian introYin">
			<div class="introYinL">我的个人简介</div>
			<div class="introYinR"><span class="areaK"></span>/2000</div>
		</div>
		<div class="bian yanse">
			<textarea name="" id="aa" maxlength="2000"></textarea>
			<p class="aaP">不会写简介？戳这里<i class='iconfont icon-arrow-right-copy'></i></p>
		</div>
		<div class="bian introYin">
			<div class="introYinL">我的声音</div>
			<div class="introYinR csa"></div>
		</div>
		<div class="bian introSY">
      <audio autoplay></audio>
      <div class="audio">
      	<div class="audioBtnL">
      		<div class="audioBof"><img src="__ROOT__ /AI_radar/image/my/lytbdx.png" class="SYBimg" alt=""></div>
      	</div>
      	<div class="audioBtnR">
<!--			<div class="audioBtnRT"><span class="audioBtnRTX">0</span>/<span class="audioBtnRTZ">0</span></div>-->
			<div class="audioBtnRT" style="height: 25px"></div>
          <div class="audioBtnRB">点击这里录制声音</div>

        </div>
        <div class="audioBtnC"><div class="chuans">上传</div></div>

      </div>
		</div>
		<div class="bian introYin">
			<div class="introYinL">我的标签</div>
			<div class="introYinR"><span class="biaoK"></span>/10</div>
		</div>
		<div class="bian introBiao">
			<div class="introAdd">
				<!-- <div class="introAddNtn" onclick="add()"></div> -->
				<div class="introAddNtn"><i class='iconfont icon-jiahao1'></i></div>

			</div>
			<div class="introcan">可参考标签</div>
			<div class="introkao">
				<text class="texts">拿证快</text>
				<text class="texts">一人一车</text>
				<text class="texts">性格和善</text>
				<text class="texts">技术过硬</text>
				<text class="texts">免费练车</text>
				<text class="texts">幽默风趣</text>
			</div>
		</div>
		<div class="bian introYin">
			<div class="introYinL">我的照片</div>
			<div class="introYinR"><span class="zhaoK"></span>/9</div>
		</div>
		<div class="bian introZhao">
			<div class="mainContainer">
			    <div class="nav-box" >
			      <div id="process" class="tab-content">
			        <div class="tab-pane fade in active" id="h5">
			          <div id="fsUploadProgress"></div>
			          <div class="chuan">
				          <form method="post" enctype="multipart/form-data" id="form" action="upload">
				            <div id="box2" style="border: 1px solid #4f81d4;">
				              <button class="select-button select-button" sid=''><i class='iconfont icon-jiahao1'></i></button>
				              <input class="file-input" type="file" id="select2" sid='' class="select2" multiple="multiple" accept="image/*"/>
				            </div>
				          </form>
				          <div class="uploading uploading" id="uploading">开始上传</div>
			          </div>
			        </div>
			      </div>
			    </div>
			  </div>
			</div>
		<!-- </div> -->
    <!-- </div> -->
    <p class="zhus">保存之前请先点击“开始上传”上传图片,图片上传完成后再保存</p>
		<div class="baoBtn">保存</div>
		<!-- <input class="aa" type="text" value id="a" name="ss"> -->
		<!-- <textarea name="" id="" class="aa" ></textarea> -->
	
	</div>
  <div class="tants">
    <div class="ttz">
      <div class="ttzt">个人介绍参考</div>
      <div class="ttzdiv">HI,欢迎来到我的个人名片。我是xxx,在xxx公司xxx部门担任xxx职位，负责xxx工作（工作职责）。进入xxx公司之前我曾在xxx公司（以往公司）担任xxx职位，拥有x年的xxx经验（比如市场销售）,在xxx领域里（专业领域）经验丰富。工作之外，我喜欢唱歌和跑步，与家人一起旅行是我最大的快乐。（兴趣爱好）您可以通过名片中的官网、商城等更多的了解新华扬，如有业务合作或其它任何问题，请与我联系，我会第一时间回复您！</div>
      <div class="ttzBtn"><i class="iconfont icon-cha ttzG"></i></div>
    </div>
  </div>
  <div class="tanSY">
    <div class="tSYz" id="div1">
      <div class="tSYzt">录制语音推荐语</div>
      <div class="tSYzi"id="div2">
        <p class="tsTimes">您还可以录制<span class="tsTimesNum">60</span>秒</p>
        <div class="tSYzn" id='luzhi' style="display: block">
          <img src="__ROOT__ /AI_radar/image/my/ly1.jpg" class="tSYimg" alt="">
        </div>
		  <div class="tSYzn" id='luzhi2' style="display: none">
			  <img src="__ROOT__ /AI_radar/image/my/ly2.gif" class="tSYimg" alt="">
		  </div>
      </div>
      <div class="tSYzts">点击图标开始录音</div>
      <div class="tSYzli">hi，你好，能认识你是缘分，欢迎来到我的电子名片；我叫xxx,是xxx公司xxx（职位），希望为更多有需要xxx产品的人提供更好的产品服务，做不了生意可以交个朋友哦，请收下我的名片</div>
      <div class="tSYzBtn"><i class="iconfont icon-cha ttzG"></i></div>
    </div>
  </div>
  <div class="tanbiao">
    <div class="tbz">
      <div class="tbzt">添加标签</div>
      <div class="tbzi"><input type="text" class="tbzinput" placeholder="请输入标签名"></div>
      <div class="tbzBtn">
        <div class="tbzBtnN">取消</div>
        <div class="tbzBtnY">确定</div>
      </div>
    </div>
  </div>
  <div class="CRM_log" style="display:block;position: fixed;top: 0;left: 0;background:rgba(0,0,0,0);width:100%;height: 100%;">
        <div style="width:100%;height:100%;display:flex;vertical-align: middle;">
          <div style="width:3rem;height:3rem;margin: auto;">
            <img src="http://resource.17jxyx.com/goods/15537572830000.gif" alt="" class="load1Img" style="width:100%;height:auto;border-radius: 0.4rem;background: rgba(255,255,255,0.3)" />
           <!--  <div class="loadFont" style='width:100%;text-align: center;display: block;color:#fff;font-size: 20px;'>正在加载...</div> -->
          </div>
        </div>
    </div>
<!--	{include file="public/wx_share" /}-->

	<!--   <div class="CRM_log" style="display:none;width:100%;height: 100%;position: fixed;top: 0;left: 0;background: rgba(0,0,0,0.9);">
          <div class="CRM_logz"style="width:100%;height: 30px;line-height:30px;font-size:20px;text-align:center;color:#fff;vertical-align: middle;margin-top:50%">正在上传....</div>
      </div> -->
</body>

<script src='__ROOT__ /AI_radar/js/jquery.js'></script>
<script type="text/javascript" src='__ROOT__ /AI_radar/js/qiniu/qiniu.min.js'></script>
<script type="text/javascript" src='__ROOT__ /AI_radar/js/qiniu/md5.js'></script>
<script type="text/javascript" src='__ROOT__ /AI_radar/js/qiniu/widget.js'></script>
<script type="text/javascript" src='__ROOT__ /AI_radar/js/qiniu/common.js'></script>
<script type="text/javascript" src='__ROOT__ /AI_radar/js/qiniu/ui.js'></script>
<!-- <script type="text/javascript" src='qiniu/uploadWithSDK.js'></script> -->
<!-- <script src='__ROOT__ /AI_radar/js/my/sy.js'></script> -->
<script src='__ROOT__ /AI_radar/js/audio.js'></script>
<!-- topR -->
<script type="text/javascript">
    var config = {$config};
  var num = 8;//商品图片最大上传数量为9
  var audioUrl;
  var audioId;//上传的音乐id
  var newAudioId;//上传的音乐id
  var labelArr=[]//添加标签
  var imgArr = []//添加照片
  var audioLing;
  var audioM = "";//已有语音地址
  var biaoNum=0//判断标签个数
  var SYBimg = document.querySelector(".SYBimg")
  var abstractid;//判断是否是第一次添加数据
    var test = window.location.href;
  $.ajax({
      url: window.urls.url +"/my/extend",
      type:"POST",
      contentType: "application/json",
      dataType:"json",
      data:JSON.stringify({
        token:window.tokens.token_boss,
      }),
      success:function(res){
        console.log(res)
        $(".CRM_log").css("display","none")
        $("#aa").val(res.data[0].abstract)
        $(".areaK").html(res.data[0].abstract.length)
        abstractid = res.data[0].id
        if(res.data[0].audio){
          audioId = res.data[0].audio.id
          audioM = res.data[0].audio.url
        }
        // console.log(audioId)

        // console.log(res.data[1])
        // audioM = "http://resource.17jxyx.com/" + res.data[0].audio.key
        // audioM = "http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E06DCBDC9AB7C49FD713D632D313AC4858BACB8DDD29067D3C601481D36E62053BF8DFEAF74C0A5CCFADD6471160CAF3E6A&fromtag=46"
        // console.log(audioM)

        // delsQi = res.data[2]
        $(".zhaoK").html(res.data[2].length)
        num = num - res.data[2].length
        $(".biaoK").html(res.data[1].length)
        biaoNum = res.data[1].length

        $.each(res.data[1], function(index1, doms1) {
          var text = document.createElement("text");
          text.className = "text"
          introAdd.insertBefore(text,introAddNtn);

        var text1 = document.createElement("text");
          text1.className = "text1"
          text1.textContent = doms1.name
          text.appendChild(text1);

        var i = document.createElement("text");
          i.className = "iconfont icon-cha zt"
          text.appendChild(i);

          labelArr.push(doms1.name)
          biaoJ()
        })
        // console.log(labelArr)
        if(res.data[2].length>0){
          $.each(res.data[2], function(index, doms) {
            var parent =$("<div class='tuDiv'><div><img class='imgs' src='"+doms.url+"'><div class='jind'>已上传</div><div class='jind'></div><div class='dels delsxiangs' id='dels' cid='"+doms.id+"'>删除</div></div></div>")
            $(parent).appendTo("#fsUploadProgress")
            var objse = {img_id:doms.id}
            delsQi.push(objse)
          })
          delQiniu($(".delsxiangs"),"pan","introduce")
        }
      },
      error:function(res){
        $(".CRM_log").css("display","none")
        console.log(res)
      }
  });

  // 微信配置
  wx.config({
      beta: true,
      debug: false,
      appId: config.appid,
      timestamp: config.timestamp,
      nonceStr: config.nonceStr,
      signature: config.signature,
      jsApiList: ['hideMenuItems','hideAllNonBaseMenuItem','startRecord','stopRecord','playVoice','stopVoice','pauseVoice','uploadVoice','downloadVoice','onVoicePlayEnd'] // 功能列表，我们要使用JS-SDK的什么功能
  });
  wx.ready(function(e){
      wx.hideMenuItems({
          menuList: ["menuItem:share:appMessage"] // 要隐藏的菜单项，所有menu项见附录3
      });
      wx.hideAllNonBaseMenuItem();

  });
  wx.error(function(res){
      // console.log(res)
  });

  var setTimeLu
  var localId//录音地址
  var serverId//音频的服务器端ID
  var numTime = 60
	var locals = 1
  // if(document.querySelector("#luzhi")){
	//录制语音
      document.querySelector("#luzhi").onclick = function(){
          // console.log("录制")
          wx.startRecord();
		  locals = 2
          document.querySelector("#luzhi").style.display = "none"
          document.querySelector("#luzhi2").style.display = "block"
          setTimeLu = setInterval(function(){
              numTime--
              if(numTime >= 0){
                  document.querySelector(".tsTimesNum").innerHTML = numTime
              }else{
                  document.querySelector(".tsTimesNum").innerHTML = "0"
                  wx.stopRecord({
                      success: function (res) {
                          localId = res.localId;
                      }
                  });
                  clearInterval(setTimeLu)
                  numTime = 60
                  document.querySelector("#luzhi2").style.display = "none"
                  document.querySelector("#luzhi").style.display = "block"
                  document.querySelector(".tSYzts").style.color = "#111111"
              }
          },1000)
          $(".tSYzts").css("color","red")
      }
      // 停止录制
      document.querySelector("#luzhi2").onclick = function(){
          document.querySelector("#luzhi2").style.display = "none"
          document.querySelector("#luzhi").style.display = "block"
          clearInterval(setTimeLu)
          wx.stopRecord({
              success: function (res) {
                  localId = res.localId;
              }
          });
          numTime = 60
          document.querySelector(".tSYzts").style.color = "#111111"
      }
      //上传语音
      function audioUploading() {
          wx.uploadVoice({
              localId:localId, // 需要上传的音频的本地ID，由stopRecord接口获得
              isShowProgressTips: 1, // 默认为1，显示进度提示
              success: function (res) {
                  console.log(res.serverId)
                  console.log(test.slice(test.indexOf('?corpid=')+8))
				  $(".CRM_log").css("display","block")
                  $.ajax({
                      url: window.urls.url +"/my/audio",
                      type:"POST",
                      contentType:"application/json",
                      dataType:"json",
                      data:JSON.stringify({
                          corpid:test.slice(test.indexOf('?corpid=')+8),
                          media_id:res.serverId,
                      }),
                      success: function(res){
						  $(".CRM_log").css("display","none")
                          console.log(res)
						  if(res.data.img_id){
							  alert("上传成功")
							  newAudioId = res.data.img_id
						  }else{
							  alert("上传失败，请重试")

						  }

                      },
                      error: function(res){
                          console.log(res)
                      },
                  })
              }
          });
      }
	//关闭录音弹框
	$(".tSYzBtn").click(function(){
		$(".tanSY").css("display","none")
		// if(localId == ''){
			wx.stopRecord({
				success: function (res) {
					localId = res.localId;
				}
			});
		// }
	})
	var audioP1 = true;

	//语音播放
      document.querySelector(".audioBof").onclick = function(){
  		// console.log(localId)
		  if(locals == 2){
			  console.log(audioP1)
			  if($("audio")){
				  $("audio").remove()
			  }
			  if(audioP1){
				  // audioss.src = audioM
				  SYBimg.src = "__ROOT__ /AI_radar/image/my/lytbdx.gif"
				  // console.log(audioss.duration)
				  wx.playVoice({
					  localId: localId // 需要播放的音频的本地ID，由stopRecord接口获得
				  });
				  audioP1 = false
				  // bofangl(audioss)

			  }else{
				  // audioss.pause()
				  // wx.pauseVoice({
					//   localId: localId // 需要暂停的音频的本地ID，由stopRecord接口获得
				  // });
				   wx.stopVoice({
				    localId: localId // 需要停止的音频的本地ID，由stopRecord接口获得
				  });
				  SYBimg.src = "__ROOT__ /AI_radar/image/my/lytbdx.png"

				  // clearInterval(set)
				  audioP1 = true;
			  }
		  }else{
		  	if(audioM == ''){
				alert("暂无声音，请点击“录制我的声音”录制")
				console.log("读取")
			}else{
				audioss.src = audioM
				SYBimg.src = "__ROOT__ /AI_radar/image/my/lytbdx.gif"
				audioP1 = false
			}


		  }
		  // if(locals == 2){
			//   wx.playVoice({
			// 	  localId: localId // 需要播放的音频的本地ID，由stopRecord接口获得
			//   });
		  // }else{
		  // 	alert("请先录制你的声音")
		  // }
      }
      //语音上传
      $(".chuans").click(function () {
          console.log(localId)
		  if(locals == 2) {
			  audioUploading()
		  }else{
		  	alert("请先录制你的声音")
		  }
      })
  // }

	
  var introAdd = document.querySelector(".introAdd");
  var introAddNtn = document.querySelector(".introAddNtn");
  var tSYimg = document.querySelector(".tSYimg");

	$(".areaK").html("0")
	$(".biaoK").html("0")
	$(".zhaoK").html("0")
  $(".aaP").click(function(){
    $(".tants").css("display","block")
  })
  $(".ttzBtn").click(function(){
    $(".tants").css("display","none")
  })
    //propertychange监听input里面的字符变化,属性改变事件
    $('#aa').bind('input propertychange', function() {
        var $this = $(this);
        var text_length = $this.val().length;//获取当前文本框的长度
        $(".areaK").html(text_length)
        if(text_length >= 2000){
          alert("最多输入2000字")
        }
    });

    
    $(".audioBtnR").click(function(){
			// audio.pause()
			audioP1 = true;
			SYBimg.src = "__ROOT__ /AI_radar/image/my/lytbdx.png"
			clearInterval(set)
			$(".tanSY").css("display","block")
			var div1 = document.getElementById("div1");
			var div1h = div1.offsetHeight;
			var div2 = document.getElementById("div2");
			var div2h = div2.offsetHeight;
			console.log(div1h,div2h)
			var tSYztshei = div1h - div2h - 50 - 70 + "px"
			$(".tSYzli").css("height",tSYztshei)
    })


    var set;
    function bofangl(audios){
      $(".audioBtnRTX").html("0")
      $(".audioBtnRTZ").html("0")
      var fenz = 0;
      var fenz1 = 0;
      var fenx = 0;
      var fenx1 = 0;
      set = setInterval(function(){
        // inp.value = audio.currentTime / audio.duration * 100;
        // console.log(parseInt(audios.currentTime),parseInt(audios.duration))
        // console.log(audios.currentTime,audios.duration)
        if(audios.currentTime >= audios.duration){
          SYBimg.src = "__ROOT__ /AI_radar/image/my/lytbdx.png"
          audios.pause()
          clearInterval(set)
          audioP1 = true;
        }
        $(".audioBtnRTX").html(parseInt(audios.currentTime))
        $(".audioBtnRTZ").html(parseInt(audios.duration))
 
      },1000)
    }
    var audioss = document.querySelector("audio")
	var spans;
  function delQiniuY(dele,typename){
      $.ajax({
        url: window.qiniuUrl.url +"/file/delete?img_id="+dele+"&type="+typename,
        type:"delete",
        contentType:"application/json",
        dataType:"json",
        beforeSend: function(request) {
            request.setRequestHeader("token",window.tokens.token_boss);
        },
        success: function(res){
          console.log(res)
         
        },
        error: function(res){
          console.log(res)
        },
      })
  }


    function stopRecord(){
      recorder.stop();
    };
    
    function playRecord(){
      recorder.play(audio);
    };
    //添加标签
    introAddNtn.onclick = function(){
    	$(".tanbiao").css("display","block")
    }
    //关闭标签弹框
    $(".tbzBtnN").click(function(){
      $(".tanbiao").css("display","none")
    })
    //开启标签弹框
    $(".tbzBtnY").click(function(){
      if($(".tbzinput").val() != ''){
        if($(".tbzinput").val().length <= 8){

          textChong($(".tbzinput").val())
          $(".tanbiao").css("display","none")
        }else{
          alert("标签长度不能超过8个字符")
        }
      }else{
        alert("请输入标签名")
      }
    })
    //删除标签
    function biaoJ(){
      var zt = document.querySelectorAll(".zt")
      Array.from(zt).forEach(function(a,b){
        a.onclick = function(){
          labelArr.forEach(function(dom,ind){
            if(dom == a.parentNode.childNodes[0].innerHTML){
              console.log(ind)
              labelArr.splice(ind,1)
            }
          })
          a.parentNode.remove()
          biaoNum--
          $(".biaoK").html(biaoNum)
        }
      })
    }
    //添加标签
    function addText(textDom){
      if(biaoNum<10){
        biaoNum++
        var text = document.createElement("text");
          text.className = "text"
          introAdd.insertBefore(text,introAddNtn);

        var text1 = document.createElement("text");
          text1.className = "text1"
          text1.textContent = textDom
          text.appendChild(text1);

        var i = document.createElement("text");
          i.className = "iconfont icon-cha zt"
          text.appendChild(i);

          labelArr.push(textDom)
	    	$(".biaoK").html(biaoNum)
        biaoJ()
      }else{
        alert("对比起最多只能添加10个标签")
      }
    }
    //判断标签是否存在
    function textChong(textDom){
      var text = document.querySelectorAll(".text1")
      console.log(text.length)
      if(text.length <1){
        addText(textDom)
      }else{
        var pan = true;
        Array.from(text).forEach(function(doms,inds){
          if(doms.innerHTML == textDom){
            alert("该标签已经存在，请勿重复添加")
            pan = false;
            return false;
          }
        })
        if(pan){
          addText(textDom)
        }
        
      }
    }
    //点击参考标签
    var texts = document.querySelectorAll(".texts")
    Array.from(texts).forEach(function(dom,ind){
      dom.onclick = function(){
        textChong(dom.innerHTML)
        console.log(dom.innerHTML)
      }
    })
    $('.tbzinput').bind('input propertychange', function() {
        var $this = $(this);
        var text_length = $this.val().length;//获取当前文本框的长度
        $(".AddFK").html(text_length)
        if(text_length >=8){
          alert("最多只能输入8个字符")
        }
    });



 //图片上传
  var delsQi = [];
  var arrsname = [];
  var arr = []//base64
    $.ajax({
      url: window.qiniuUrl.url +"/token/file/introduce",
      datauser:"json",
      beforeSend: function(request) {
          request.setRequestHeader("token",window.tokens.token_boss);
      },
      success: function(res){
        var token = res.token;
        var domain = res.url;
        var config = {
          useCdnDomain: true,
          disableStatisticsReport: true,
          retryCount: 6,
          region: qiniu.region.z2
        };
        var putExtra = {
          fname: "",
          params: {},
          mimeType: null
        };
        function nam(){
          console.log(this)
        }
        uploadWithSDK(token, putExtra, config, domain,'introduce');
      }
    })
function uploadWithSDK(token, putExtra, config, domain, typename) {
  // 切换tab后进行一些css操作
  var fileArr = []//file
  var timesKey = []//时间戳
  var boards = []
   

    $("#select2").unbind("change").bind("change",function(){

      var types = this.getAttribute("sid")
      var files = this.files
      for(var j=0;j<files.length;j++){
        var file = this.files[j];
        var finishedAttr = [];
        var compareChunks = [];
        var observable;
          var timestamp;
          // console.log(timestamp)
        if (file) {
          // console.log(file)
          var key = file.name;
          console.log(key)
          if(arr.length <= num){
	          if(arrsname.length<1){
	            timestamp = Date.parse(new Date()) + j;
	            timesKey.push(timestamp)
	            fileArr.push(file)
	            arr.push(key)
	            arrsname.push(key)
	            // filefileArr.push(file)
	          }else{
	            var pans = true;
	            for (var i = 0; i < arrsname.length; i++) {
	              if(arrsname[i] == file.name){
	                pans = false;
	                alert('对不起，您已经添加过这张图片了');
	                return false;
	              }else{
	                pans = true;
	              }
	            }
	            if(pans){
	              timestamp = Date.parse(new Date()) + j;
	              timesKey.push(timestamp)
	              arr.push(key)
	              fileArr.push(file)
	              arrsname.push(key)

	            }else{
	              alert('对不起，您已经添加过这张图片了');
	                return false;
	            }
	          }
          }else{
          	alert("对不起，最多只能上传9张")
          	return false;
          }
          var fr = new FileReader();
          fr.readAsDataURL(file);
            
            // 添加上传dom面板
            var board = addUploadBoard(file, config, key,'base64', types, "");
            boards.push(board)
            console.log($(".del"))

            dels($(".del"))
            console.log(board)
            if (!board) {
              return;
            }
        }
      }
  })

  $("#uploading").click(function(){
    $(".CRM_log").css("display","block")
    // if(fileArr.length > 0){
    //   $("#uploadingxiang").removeClass("uploadingxiang")
    //   $("#uploadingxiang").css("background","#ccc")
    // }
    console.log(fileArr)

    var non = document.querySelectorAll(".del")
    Array.from(non).forEach(function(domc,domd){
      domc.classList.add("cang")
    })
    var ling=[]
    fileArr.forEach(function(dom,index){
      boards.forEach(function(boardOne,v){
          if( v == index){
           // putExtra.params["x:name"] = key.split(".")[0];
        putExtra.params["x:name"] = "introduce"
        // console.log(putExtra.params["x:name"])
        boardOne.start = true;

    //     // 设置next,error,complete对应的操作，分别处理相应的进度信息，错误信息，以及完成后的操作
        var error = function(err) {
          arrsname.forEach(function(namel,namem){
            fileArr.forEach(function(namex,namey){
              if(namex.name == namel){
                arrsname.splice(namem,1)
              }
            })
          })
          arr.forEach(function(nac,nae){
            fileArr.forEach(function(naa,nab){
              if(naa.name == nac){
                arr.splice(nae,1)
              }
            })
          })
          fileArr = []//file
          timesKey = []//时间戳
          boards = [];
          // $("#uploadingxiang").addClass("uploadingxiang")
          // $("#uploadingxiang").css("background","#1963AA")
          console.log(err);
          alert("上传出错")
          $(".CRM_log").css("display","none")
          var objss = {err:"500"}
          ling.push(objss)
        };

        var complete = function(res) {
          var obj = res;
          console.log(res)
          obj.type = ""
          delsQi.push(obj)
          ling.push(res)
          

          if(res.name != ''){
          	console.log(delsQi)
            var keys = res.name; 
            var ranks1 = keys.indexOf('.');
            var ranks3 = ranks1;
            var ranks = keys.slice(0,ranks3);
            $(".tuDiv").each(function(tuDiva,tuDivb){
              if(tuDivb.children[0].getAttribute("did") == res.name){
                console.log(tuDivb.children[0].children[1])
                tuDivb.children[0].children[1].innerHTML = "上传完成"
                tuDivb.children[0].children[3].setAttribute("cid", res.img_id);
                tuDivb.children[0].children[3].setAttribute("eid", res.name);
                tuDivb.children[0].children[3].classList.remove("cang")
                delQiniu($(".dels"),"",typename)
              }
            })
          }
          console.log(ling.length,fileArr.length)
          console.log(ling,fileArr)

          if(ling.length >= fileArr.length){
            // arr = []//base64
            fileArr = []//file
            timesKey = []//时间戳
            boards = [];
            $(".CRM_log").css("display","none")
            alert("上传完成")
          }
        };

        var next = function(response) {
          var chunks = response.chunks||[];
          var total = response.total;
          // 这里对每个chunk更新进度，并记录已经更新好的避免重复更新，同时对未开始更新的跳过
          // for (var i = 0; i < chunks.length; i++) {
          //   if (chunks[i].percent === 0 || finishedAttr[i]){
          //     continue;
          //   }
          //   if (compareChunks[i].percent === chunks[i].percent){
          //     continue;
          //   }
          //   if (chunks[i].percent === 100){
          //     finishedAttr[i] = true;
          //   }
          // }
          // compareChunks = chunks;
        };

        var subObject = { 
          next: next,
          error: error,
          complete: complete
        };
        var subscription;
        var names = dom.name
        var rank1 = names.indexOf('.');
        var rank3 = rank1;
        var rank = names.slice(rank3);
        var ranks = token.slice(10,25);
        var timetamp;
        timesKey.forEach(function(x,y){
          if(y==index){
            // timetamp = hex_md5(x);
            timetamp = x;
          }
        })
        var key = typename+"/"+timetamp+index+ranks+rank
        console.log(key)

    //     // 调用sdk上传接口获得相应的observable，控制上传和暂停
        observable = qiniu.upload(dom, key, token, putExtra, config);

        subscription = observable.subscribe(subObject);

      }
    })
    })
  })


  function dels(dele){
    Array.from(dele).forEach(function(doma,domb){
      doma.onclick = function(){
        var base64s = doma.parentNode.children[1].getAttribute("base64s")
        // console.log(doma.parentNode.children[1].getAttribute("base64s"))
        arr.forEach(function(a,b){
          if(a == base64s){
            arr.splice(b,1)
          }
        })
        arrsname.forEach(function(cs,bs){
          if(cs == base64s){
            arrsname.splice(bs,1)
          }
        })
        fileArr.forEach(function(c,d){
          
          if(c.name == base64s){
            fileArr.splice(d,1)
          }
        })
        boards.splice(arr.indexOf(base64s,0),1)
        timesKey.splice(arr.indexOf(base64s,0),1)

        doma.parentNode.parentNode.remove()

      }
    })
  }

}
   function delQiniu(dele,type,typename){
    Array.from(dele).forEach(function(doma,domb){
      doma.onclick = function(){
        if(type == ""){
          	arr.forEach(function(q,w){
          		if(q == doma.getAttribute("eid")){
          			arr.splice(arr.indexOf(q,0),1)
          		}else{
                num--
              }
          	})
          }
          if(type == "xiang"){
          	arr2.forEach(function(qq,w){
          		if(qq == doma.getAttribute("eid")){
          			arr2.splice(arr2.indexOf(qq,0),1)
          		}
          	})
          }
          // alert(doma.getAttribute("cid") + typename)
          if(doma.getAttribute("cid")){
            $.ajax({
              url: window.qiniuUrl.url +"/file/delete?img_id="+doma.getAttribute("cid")+"&type="+typename,
              type:"delete",
              contentType:"application/json",
              dataType:"json",
              beforeSend: function(request) {
                  request.setRequestHeader("token",window.tokens.token_boss);
              },
              success: function(res){
                console.log(res)
                // alert(res+"正确")
                delsQi.forEach(function(po,ins){
                  if(po.img_id == doma.getAttribute("cid")){
                    delsQi.splice(ins,1)
                  }
                })
                console.log(delsQi)

                doma.parentNode.parentNode.remove()
              },
              error: function(res){
                // alert(res+"错误")
                doma.parentNode.parentNode.remove()
                console.log(res)
              },

            })
          }
          

      }
    })

  }


//保存信息
$(".baoBtn").click(function(){
  var synopsis = $("#aa").val()
  console.log(synopsis,audioId,labelArr,delsQi)
  var synopsisArr = []
  var audioArr = []
	var audioObj={
		audio_id:'',
		oldAudio_id:''
	}
	console.log(audioObj)
	console.log(newAudioId)
	console.log(audioId)


	if(newAudioId){
		audioObj.audio_id = newAudioId
		if(audioId){
			audioObj.oldAudio_id = audioId
		}
	}
	audioArr.push(audioObj)
	console.log(audioArr)
  // if(audioId){
	//   audioObj.audio_id = audioId
  //   // var audioObj = {audio_id:audioId};
  // }
	// audioArr.push(audioObj)
	// newAudioId
  var imgArr = []
  delsQi.forEach(function(a,b){
    var objshop={
        img_id:parseInt(a.img_id)
    }
    imgArr.push(objshop)
  })
// var synopsisObj = {id:abstractid,content:synopsis}
  synopsisArr.push(synopsis)
  if(abstractid){
    synopsisArr.push(abstractid)
  }
  if(!synopsisArr[0]){
    alert("我的个人简介不能为空")
    return false;
  }
  if(labelArr.length==0){
    alert("至少需要添加一个标签")
    return false;
  }
  $(".CRM_log").css("display","block")
	if(locals == 2 && !newAudioId){
		if(confirm("你的录音还未上传是否放弃上传录音？")){

		}else{
			$(".CRM_log").css("display","none")
			return false;
		}
	}
  $.ajax({
      url: window.urls.url +"/my/extend/add",
      type:"POST",
      contentType: "application/json",
      dataType:"json",
      data:JSON.stringify({
        token:window.tokens.token_boss,
        synopsisArr:synopsisArr,
        audioArr:audioArr,
        labelArr:labelArr,
        imgArr:imgArr
      }),
      success:function(res){
        $(".CRM_log").css("display","none")
        console.log(res)
        console.log(res.data)
        if(res.data){
          alert("保存成功")
        }else{
          alert("保存失败，请重新修改")
        }
        window.history.go(-1)


        // window.location.href= window.urls.url +`/my/compile?corpid=${localStorage.getItem("CRM_corpId")}`
      },
      error:function(res){
        $(".CRM_log").css("display","none")
        console.log(res)
      }
  });
})
$(".csa").click(function(){
  audioId = 15
  console.log(audioId)
})




</script>
</html>